package Conf

import (
	"fmt"
	"github.com/spf13/viper"
)

type Conf struct {
	Mysql Mysql
	Redis Redis
}
type Mysql struct {
	User     string
	Password string
	Host     string
	Port     string
	Database string
}
type Redis struct {
	Host     string
	Port     string
	Password string
}
type PkgConf struct {
	AliPay AliPay
}
type AliPay struct {
	AppId string
	Key   string
}

var Config Conf
var PConfig PkgConf

func ConfInit() {
	viper.SetConfigFile("../Conf/conf.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&Config)
	viper.SetConfigFile("../Conf/pkg_conf.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&PConfig)
	fmt.Println(Config)
	fmt.Println(PConfig)
}
